home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / RADIO_BU.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  3.7 KB  |  122 lines

  1. package sub_arctic.lib;
  2.  
  3. import sub_arctic.input.*;
  4. import sub_arctic.output.*;
  5.  
  6. /**
  7.  * This is a version of a toggle which implements the look of a radio
  8.  * button via the style system.
  9.  * 
  10.  * @author Ian Smith
  11.  */
  12.  
  13. public class radio_button extends toggle {
  14.  
  15.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  16.  
  17.   /**
  18.    * Make a radio button in the current style.
  19.    * 
  20.    * @param int             x          the x position of this interactor.
  21.    * @param int             y          the y position of this interactor.
  22.    * @param toggle          group_with what other toggle this radio_button 
  23.    *                                   should be grouped with (if you pass 
  24.    *                                   null here the radio button is "free 
  25.    *                                   standing" and should probably be a 
  26.    *                                   checkbox instead).
  27.    * @param callback_object co         the object to send the callbacks to.
  28.    */
  29.   public radio_button(int x, int y, toggle group_with, callback_object co) 
  30. {
  31.  
  32.     // default to the artkit look temporarily
  33.     super(x,y,co);
  34.  
  35.     /* set the style stuff going */
  36.     style_changed();
  37.  
  38.     /* set the toggle you are with */
  39.     if (group_with!=null) {
  40.       add_to_group_of(group_with);
  41.     }
  42.   }
  43.  
  44.    //had:
  45.    //* @exception bad_value PROPAGATED
  46.    //* @exception general PROPAGATED
  47.  
  48.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  49.  
  50.   /**
  51.    * Make a radio button in the current style with some defaults. We
  52.    * assume you are going to use constraints or direct setting to
  53.    * position this object.
  54.    * 
  55.    * @param toggle          group_with what other toggle this radio_button 
  56.    *                                   should be grouped with (if you pass 
  57.    *                                   null here the radio button is "free 
  58.    *                                   standing" and should probably be a 
  59.    *                                   checkbox instead).
  60.    * @param callback_object co         the object to send the callbacks to.
  61.    */
  62.   public radio_button(toggle group_with, callback_object co) 
  63. {
  64.  
  65.     // default to the artkit look temporarily
  66.     super(0,0,co);
  67.  
  68.     /* set the style stuff going */
  69.     style_changed();
  70.  
  71.     /* set the toggle you are with */
  72.     if (group_with!=null) {
  73.       add_to_group_of(group_with);
  74.     }
  75.  
  76.   }
  77.  
  78.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  79.  
  80.   /**
  81.    * The style has changed, regenerate.
  82.    */
  83.   public void style_changed() {
  84.     loaded_image img[];
  85.  
  86.     img=style_manager.current_style().radio_button_make_images();
  87.  
  88.     /* set the images into the slots of the multibutton */
  89.     set_state_look(0,img[0]);
  90.     set_state_look(1,img[1]);
  91.  
  92.     /* now see if they have transitions */
  93.     img=style_manager.current_style().radio_button_make_transitions();
  94.  
  95.     /* if null, we are done */
  96.     if (img==null) return;
  97.  
  98.     /* they want transitions */
  99.     set_transition_look(0,img[0]);
  100.     set_transition_look(1,img[1]);
  101.   }
  102.  
  103.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  104.  
  105. }
  106. /*=========================== COPYRIGHT NOTICE ===========================
  107.  
  108. This file is part of the subArctic user interface toolkit.
  109.  
  110. Copyright (c) 1996 Scott Hudson and Ian Smith
  111. All rights reserved.
  112.  
  113. The subArctic system is freely available for most uses under the terms
  114. and conditions described in 
  115.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  116. and appearing in full in the lib/interactor.java source file.
  117.  
  118. The current release and additional information about this software can be 
  119. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  120.  
  121. ========================================================================*/
  122.